Integrand size = 25, antiderivative size = 131 \[ \int (a+b \tan (e+f x))^2 (c+d \tan (e+f x))^2 \, dx=(a c-b c-a d-b d) (a c+b c+a d-b d) x-\frac {2 (b c+a d) (a c-b d) \log (\cos (e+f x))}{f}+\frac {b \left (2 a c d+b \left (c^2-d^2\right )\right ) \tan (e+f x)}{f}+\frac {c d (a+b \tan (e+f x))^2}{f}+\frac {d^2 (a+b \tan (e+f x))^3}{3 b f} \]
[Out]
Time = 0.21 (sec) , antiderivative size = 131, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 4, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.160, Rules used = {3624, 3609, 3606, 3556} \[ \int (a+b \tan (e+f x))^2 (c+d \tan (e+f x))^2 \, dx=\frac {b \left (2 a c d+b \left (c^2-d^2\right )\right ) \tan (e+f x)}{f}+\frac {c d (a+b \tan (e+f x))^2}{f}-\frac {2 (a d+b c) (a c-b d) \log (\cos (e+f x))}{f}+x (a c-a d-b c-b d) (a c+a d+b c-b d)+\frac {d^2 (a+b \tan (e+f x))^3}{3 b f} \]
[In]
[Out]
Rule 3556
Rule 3606
Rule 3609
Rule 3624
Rubi steps \begin{align*} \text {integral}& = \frac {d^2 (a+b \tan (e+f x))^3}{3 b f}+\int (a+b \tan (e+f x))^2 \left (c^2-d^2+2 c d \tan (e+f x)\right ) \, dx \\ & = \frac {c d (a+b \tan (e+f x))^2}{f}+\frac {d^2 (a+b \tan (e+f x))^3}{3 b f}+\int (a+b \tan (e+f x)) \left (-2 b c d+a \left (c^2-d^2\right )+\left (2 a c d+b \left (c^2-d^2\right )\right ) \tan (e+f x)\right ) \, dx \\ & = (a c-b c-a d-b d) (a c+b c+a d-b d) x+\frac {b \left (2 a c d+b \left (c^2-d^2\right )\right ) \tan (e+f x)}{f}+\frac {c d (a+b \tan (e+f x))^2}{f}+\frac {d^2 (a+b \tan (e+f x))^3}{3 b f}+(2 (b c+a d) (a c-b d)) \int \tan (e+f x) \, dx \\ & = (a c-b c-a d-b d) (a c+b c+a d-b d) x-\frac {2 (b c+a d) (a c-b d) \log (\cos (e+f x))}{f}+\frac {b \left (2 a c d+b \left (c^2-d^2\right )\right ) \tan (e+f x)}{f}+\frac {c d (a+b \tan (e+f x))^2}{f}+\frac {d^2 (a+b \tan (e+f x))^3}{3 b f} \\ \end{align*}
Result contains complex when optimal does not.
Time = 1.21 (sec) , antiderivative size = 185, normalized size of antiderivative = 1.41 \[ \int (a+b \tan (e+f x))^2 (c+d \tan (e+f x))^2 \, dx=\frac {2 d^2 (a+b \tan (e+f x))^3+3 \left (2 a c d+b \left (-c^2+d^2\right )\right ) \left (i \left ((a+i b)^2 \log (i-\tan (e+f x))-(a-i b)^2 \log (i+\tan (e+f x))\right )-2 b^2 \tan (e+f x)\right )+6 c d \left ((i a-b)^3 \log (i-\tan (e+f x))-(i a+b)^3 \log (i+\tan (e+f x))+6 a b^2 \tan (e+f x)+b^3 \tan ^2(e+f x)\right )}{6 b f} \]
[In]
[Out]
Time = 0.25 (sec) , antiderivative size = 161, normalized size of antiderivative = 1.23
method | result | size |
parts | \(a^{2} c^{2} x +\frac {\left (2 a b \,d^{2}+2 b^{2} c d \right ) \left (\frac {\left (\tan ^{2}\left (f x +e \right )\right )}{2}-\frac {\ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2}\right )}{f}+\frac {\left (2 a^{2} c d +2 a b \,c^{2}\right ) \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2 f}+\frac {\left (a^{2} d^{2}+4 a b c d +b^{2} c^{2}\right ) \left (\tan \left (f x +e \right )-\arctan \left (\tan \left (f x +e \right )\right )\right )}{f}+\frac {b^{2} d^{2} \left (\frac {\left (\tan ^{3}\left (f x +e \right )\right )}{3}-\tan \left (f x +e \right )+\arctan \left (\tan \left (f x +e \right )\right )\right )}{f}\) | \(161\) |
norman | \(\left (a^{2} c^{2}-a^{2} d^{2}-4 a b c d -b^{2} c^{2}+b^{2} d^{2}\right ) x +\frac {\left (a^{2} d^{2}+4 a b c d +b^{2} c^{2}-b^{2} d^{2}\right ) \tan \left (f x +e \right )}{f}+\frac {b d \left (a d +b c \right ) \left (\tan ^{2}\left (f x +e \right )\right )}{f}+\frac {b^{2} d^{2} \left (\tan ^{3}\left (f x +e \right )\right )}{3 f}+\frac {\left (a^{2} c d +a b \,c^{2}-a b \,d^{2}-b^{2} c d \right ) \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{f}\) | \(162\) |
derivativedivides | \(\frac {\frac {b^{2} d^{2} \left (\tan ^{3}\left (f x +e \right )\right )}{3}+a b \,d^{2} \left (\tan ^{2}\left (f x +e \right )\right )+b^{2} c d \left (\tan ^{2}\left (f x +e \right )\right )+\tan \left (f x +e \right ) a^{2} d^{2}+4 a b c d \tan \left (f x +e \right )+b^{2} c^{2} \tan \left (f x +e \right )-b^{2} d^{2} \tan \left (f x +e \right )+\frac {\left (2 a^{2} c d +2 a b \,c^{2}-2 a b \,d^{2}-2 b^{2} c d \right ) \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2}+\left (a^{2} c^{2}-a^{2} d^{2}-4 a b c d -b^{2} c^{2}+b^{2} d^{2}\right ) \arctan \left (\tan \left (f x +e \right )\right )}{f}\) | \(189\) |
default | \(\frac {\frac {b^{2} d^{2} \left (\tan ^{3}\left (f x +e \right )\right )}{3}+a b \,d^{2} \left (\tan ^{2}\left (f x +e \right )\right )+b^{2} c d \left (\tan ^{2}\left (f x +e \right )\right )+\tan \left (f x +e \right ) a^{2} d^{2}+4 a b c d \tan \left (f x +e \right )+b^{2} c^{2} \tan \left (f x +e \right )-b^{2} d^{2} \tan \left (f x +e \right )+\frac {\left (2 a^{2} c d +2 a b \,c^{2}-2 a b \,d^{2}-2 b^{2} c d \right ) \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2}+\left (a^{2} c^{2}-a^{2} d^{2}-4 a b c d -b^{2} c^{2}+b^{2} d^{2}\right ) \arctan \left (\tan \left (f x +e \right )\right )}{f}\) | \(189\) |
parallelrisch | \(\frac {b^{2} d^{2} \left (\tan ^{3}\left (f x +e \right )\right )+3 x \,a^{2} c^{2} f -3 x \,a^{2} d^{2} f -12 a b c d f x -3 b^{2} c^{2} f x +3 b^{2} d^{2} f x +3 a b \,d^{2} \left (\tan ^{2}\left (f x +e \right )\right )+3 b^{2} c d \left (\tan ^{2}\left (f x +e \right )\right )+3 \ln \left (1+\tan ^{2}\left (f x +e \right )\right ) a^{2} c d +3 \ln \left (1+\tan ^{2}\left (f x +e \right )\right ) a b \,c^{2}-3 \ln \left (1+\tan ^{2}\left (f x +e \right )\right ) a b \,d^{2}-3 \ln \left (1+\tan ^{2}\left (f x +e \right )\right ) b^{2} c d +3 \tan \left (f x +e \right ) a^{2} d^{2}+12 a b c d \tan \left (f x +e \right )+3 b^{2} c^{2} \tan \left (f x +e \right )-3 b^{2} d^{2} \tan \left (f x +e \right )}{3 f}\) | \(226\) |
risch | \(-2 i b^{2} c d x -\frac {4 i b^{2} c d e}{f}+\frac {2 i \left (-6 i b^{2} c d \,{\mathrm e}^{2 i \left (f x +e \right )}-6 i a b \,d^{2} {\mathrm e}^{2 i \left (f x +e \right )}+3 a^{2} d^{2} {\mathrm e}^{4 i \left (f x +e \right )}+12 a b c d \,{\mathrm e}^{4 i \left (f x +e \right )}+3 b^{2} c^{2} {\mathrm e}^{4 i \left (f x +e \right )}-6 b^{2} d^{2} {\mathrm e}^{4 i \left (f x +e \right )}-6 i a b \,d^{2} {\mathrm e}^{4 i \left (f x +e \right )}-6 i b^{2} c d \,{\mathrm e}^{4 i \left (f x +e \right )}+6 a^{2} d^{2} {\mathrm e}^{2 i \left (f x +e \right )}+24 a b c d \,{\mathrm e}^{2 i \left (f x +e \right )}+6 b^{2} c^{2} {\mathrm e}^{2 i \left (f x +e \right )}-6 b^{2} d^{2} {\mathrm e}^{2 i \left (f x +e \right )}+3 a^{2} d^{2}+12 a b c d +3 b^{2} c^{2}-4 b^{2} d^{2}\right )}{3 f \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right )^{3}}+\frac {4 i a b \,c^{2} e}{f}+a^{2} c^{2} x -a^{2} d^{2} x -4 a b c d x -b^{2} c^{2} x +b^{2} d^{2} x +2 i a^{2} c d x +2 i a b \,c^{2} x -2 i a b \,d^{2} x +\frac {4 i a^{2} c d e}{f}-\frac {4 i a b \,d^{2} e}{f}-\frac {2 \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) a^{2} c d}{f}-\frac {2 \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) a b \,c^{2}}{f}+\frac {2 \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) a b \,d^{2}}{f}+\frac {2 \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) b^{2} c d}{f}\) | \(465\) |
[In]
[Out]
none
Time = 0.25 (sec) , antiderivative size = 158, normalized size of antiderivative = 1.21 \[ \int (a+b \tan (e+f x))^2 (c+d \tan (e+f x))^2 \, dx=\frac {b^{2} d^{2} \tan \left (f x + e\right )^{3} - 3 \, {\left (4 \, a b c d - {\left (a^{2} - b^{2}\right )} c^{2} + {\left (a^{2} - b^{2}\right )} d^{2}\right )} f x + 3 \, {\left (b^{2} c d + a b d^{2}\right )} \tan \left (f x + e\right )^{2} - 3 \, {\left (a b c^{2} - a b d^{2} + {\left (a^{2} - b^{2}\right )} c d\right )} \log \left (\frac {1}{\tan \left (f x + e\right )^{2} + 1}\right ) + 3 \, {\left (b^{2} c^{2} + 4 \, a b c d + {\left (a^{2} - b^{2}\right )} d^{2}\right )} \tan \left (f x + e\right )}{3 \, f} \]
[In]
[Out]
Leaf count of result is larger than twice the leaf count of optimal. 258 vs. \(2 (117) = 234\).
Time = 0.13 (sec) , antiderivative size = 258, normalized size of antiderivative = 1.97 \[ \int (a+b \tan (e+f x))^2 (c+d \tan (e+f x))^2 \, dx=\begin {cases} a^{2} c^{2} x + \frac {a^{2} c d \log {\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{f} - a^{2} d^{2} x + \frac {a^{2} d^{2} \tan {\left (e + f x \right )}}{f} + \frac {a b c^{2} \log {\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{f} - 4 a b c d x + \frac {4 a b c d \tan {\left (e + f x \right )}}{f} - \frac {a b d^{2} \log {\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{f} + \frac {a b d^{2} \tan ^{2}{\left (e + f x \right )}}{f} - b^{2} c^{2} x + \frac {b^{2} c^{2} \tan {\left (e + f x \right )}}{f} - \frac {b^{2} c d \log {\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{f} + \frac {b^{2} c d \tan ^{2}{\left (e + f x \right )}}{f} + b^{2} d^{2} x + \frac {b^{2} d^{2} \tan ^{3}{\left (e + f x \right )}}{3 f} - \frac {b^{2} d^{2} \tan {\left (e + f x \right )}}{f} & \text {for}\: f \neq 0 \\x \left (a + b \tan {\left (e \right )}\right )^{2} \left (c + d \tan {\left (e \right )}\right )^{2} & \text {otherwise} \end {cases} \]
[In]
[Out]
none
Time = 0.32 (sec) , antiderivative size = 159, normalized size of antiderivative = 1.21 \[ \int (a+b \tan (e+f x))^2 (c+d \tan (e+f x))^2 \, dx=\frac {b^{2} d^{2} \tan \left (f x + e\right )^{3} + 3 \, {\left (b^{2} c d + a b d^{2}\right )} \tan \left (f x + e\right )^{2} - 3 \, {\left (4 \, a b c d - {\left (a^{2} - b^{2}\right )} c^{2} + {\left (a^{2} - b^{2}\right )} d^{2}\right )} {\left (f x + e\right )} + 3 \, {\left (a b c^{2} - a b d^{2} + {\left (a^{2} - b^{2}\right )} c d\right )} \log \left (\tan \left (f x + e\right )^{2} + 1\right ) + 3 \, {\left (b^{2} c^{2} + 4 \, a b c d + {\left (a^{2} - b^{2}\right )} d^{2}\right )} \tan \left (f x + e\right )}{3 \, f} \]
[In]
[Out]
Leaf count of result is larger than twice the leaf count of optimal. 1955 vs. \(2 (129) = 258\).
Time = 1.34 (sec) , antiderivative size = 1955, normalized size of antiderivative = 14.92 \[ \int (a+b \tan (e+f x))^2 (c+d \tan (e+f x))^2 \, dx=\text {Too large to display} \]
[In]
[Out]
Time = 6.00 (sec) , antiderivative size = 230, normalized size of antiderivative = 1.76 \[ \int (a+b \tan (e+f x))^2 (c+d \tan (e+f x))^2 \, dx=\frac {\mathrm {tan}\left (e+f\,x\right )\,\left (a^2\,d^2+4\,a\,b\,c\,d+b^2\,c^2-b^2\,d^2\right )}{f}+\frac {\ln \left ({\mathrm {tan}\left (e+f\,x\right )}^2+1\right )\,\left (a^2\,c\,d+a\,b\,c^2-a\,b\,d^2-b^2\,c\,d\right )}{f}-\frac {\mathrm {atan}\left (\frac {\mathrm {tan}\left (e+f\,x\right )\,\left (a\,c+a\,d+b\,c-b\,d\right )\,\left (a\,d-a\,c+b\,c+b\,d\right )}{-a^2\,c^2+a^2\,d^2+4\,a\,b\,c\,d+b^2\,c^2-b^2\,d^2}\right )\,\left (a\,c+a\,d+b\,c-b\,d\right )\,\left (a\,d-a\,c+b\,c+b\,d\right )}{f}+\frac {b^2\,d^2\,{\mathrm {tan}\left (e+f\,x\right )}^3}{3\,f}+\frac {b\,d\,{\mathrm {tan}\left (e+f\,x\right )}^2\,\left (a\,d+b\,c\right )}{f} \]
[In]
[Out]